home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 4
/
Apprentice-Release4.iso
/
Source Code
/
C
/
Games
/
Pentominoes 2.0
/
Pent code
/
pent endgame.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-07-29
|
2KB
|
77 lines
#include "pent endgame.h"
#include "pent graphics.h"
#include "pent main window.h"
#include "pent globals.h"
#include "dialog layer.h"
#include "sound layer.h"
#include "window layer.h"
#include "Horizontal bars wipe.h"
#define kWinAlertColor 200
#define kWinAlertBW 201
void WinGame(WindowRef theWindow)
{
short theDepth, i, j, k, refreshIndex;
MyOffscreenPtr offscreenWorldPtr;
WindowPtr offscreenWindowPtr;
MyBoardRec theBoard;
Point refresh[12][5];
Rect boundsRect;
if (gGraphicEffects)
{
HideCursor();
theDepth=GetWindowDepth(theWindow);
offscreenWorldPtr=GetWindowPermanentOffscreenWorld(theWindow);
offscreenWindowPtr=offscreenWorldPtr->offscreenPtr;
for (i=0; i<gNumRows; i++)
{
for (j=0; j<gNumCols; j++)
{
if (gBoard[i][j]<kSelectedPiece)
{
theBoard.boardData[i][j]=gBoard[i][j];
gBoard[i][j]=kEmptyTile;
}
}
}
SetPortToOffscreenWindow(offscreenWorldPtr);
DrawTheMainWindow(theWindow, theDepth);
SetPortToOnscreenWindow(theWindow, offscreenWorldPtr);
boundsRect=theWindow->portRect;
OffsetRect(&boundsRect, -boundsRect.left, -boundsRect.top);
HorizontalBarsWipe(offscreenWindowPtr, theWindow, boundsRect);
SetWindowOffscreenNeedsUpdate(theWindow, FALSE);
for (k=0; k<12; k++)
{
refreshIndex=0;
for (i=0; ((i<gNumRows) && (refreshIndex<5)); i++)
{
for (j=0; ((j<gNumCols) && (refreshIndex<5)); j++)
{
if (theBoard.boardData[i][j]==gPiecesPlayed[k])
{
refresh[k][refreshIndex].h=i;
refresh[k][refreshIndex++].v=j;
}
}
}
}
for (k=0; k<12; k++)
{
for (i=0; i<5; i++)
{
gBoard[refresh[k][i].h][refresh[k][i].v]=gPiecesPlayed[k];
}
RefreshTiles(theWindow, refresh[k], 5, FALSE, FALSE);
DoSound(sound_placepiece, (k<11));
CompactMem(maxSize);
}
ShowCursor();
}
DoSound(sound_wingame, TRUE);
DisplayTheAlert(kPlainAlert, (GetWindowRealDepth(0L)>2) ? kWinAlertColor : kWinAlertBW,
"\p", "\p", "\p", "\p", (UniversalProcPtr)OneButtonFilter);
}